package com.lq.ecoldchain.ui.main

import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.lq.ecoldchain.R
import com.lq.ecoldchain.base.view.App
import com.lq.ecoldchain.internet.BaseObserver

/*
*2018/12/25 0025  11:34
*function by lq
*/
object MainModel{
     var titles: Array<String> = arrayOf("首页", "消息", "一键介绍", "订单", "我的")
    private var icons: IntArray = intArrayOf(R.drawable.selector_home_icon, R.drawable.selector_msg_icon, R.drawable.selector_ing_icon, R.drawable.selector_order_icon, R.drawable.selector_mine_icon)
    val views by lazy { ArrayList<View>() }

    init {
        views.add(getTabView(0))
        views.add(getTabView(1))
        views.add(getTabView(2))
        views.add(getTabView(3))
        views.add(getTabView(4))


    }


    private fun getTabView(position: Int): View {
        val view = LayoutInflater.from(App.instance).inflate(R.layout.tab_home, null)
        val title = view.findViewById<TextView>(R.id.text1)
        title.text = titles[position]
        val icon = view.findViewById<ImageView>(R.id.image1)
        icon.setImageResource(icons[position])
        return view
    }
}